# Definition for singly-linked list.
class ListNode(object):
    def __init__(self, x):
        self.val = x
        self.next = None

class Solution(object):
    def deleteNode(self, node):
        """
        :type node: ListNode
        :rtype: void Do not return anything, modify node in-place instead.
        """
        l1 = ListNode(1)
        l1.next = ListNode(node)
        l1.next.next = ListNode(3)

        head = cur  = l1

        while cur:
            if cur.val == node:
                head.next = cur.next
                cur = cur.next
            else:
                head = cur
                cur = cur.next
        return l1





m = Solution()
s = m.deleteNode(2)

while s!= None:
    print(s.val)
    s = s.next